<!-- 赛事进行中 -->
<template>
	<view class="item-block">
		<view class="headerimg">
		</view>
		<view class="capsule" :style="{top:capsule.top + 'px' , width: capsule.width - 20 + 'px',
    height: capsule.height - 5 + 'px'}">
			<view class="iconfont icon-fanhui" @click="goonefn">
			</view>
			<view class="iconfont icon-zhuye" @click="gohomefn">
			</view>
		</view>

		<view class="broadcast" style="">
			<view class="weather">
				<view class="weather_text">
					风力 {{weather.winSpeed}}
				</view>
				<view class="weather_item">
					{{weather.win}}
				</view>
			</view>
			<view class="weather_cen">
				<view class="cen_name">
					{{form.raceName}}
				</view>
				<view class="weather_place">
					<span class="iconfont icon-dizhi"></span>
					<span class="">{{form.placeName}}</span>
				</view>
			</view>
			<view class="weather">
				<view class="weather_text">
					天气 {{weather.wea}}
				</view>
				<view class="weather_item">
					{{weather.temDay}}° ~ {{weather.temNight}}°
				</view>
			</view>
		</view>
		<view class="ranking">
			<view class="title">
				比赛排行
			</view>
			<view class="ranking_table">
				<view class="table_left">
					<uni-table ref="table" :loading="loading" border emptyText="暂无更多数据">
						<uni-tr>
							<uni-th align="center">HOLE</uni-th>
						</uni-tr>
						<uni-tr>
							<uni-th align="center">PAR</uni-th>
						</uni-tr>
						<uni-tr v-for="(item, index) in teamlistarr" :key="index">
							<uni-td>{{ item.teamName.length > 6 ? item.teamName.slice(0, 6) + '...' : item.teamName }}</uni-td>
						</uni-tr>
					</uni-table>
				</view>
				<view class="table_right">
					<uni-table ref="table" :loading="loading" border emptyText="暂无更多数据">
						<uni-tr>
							<uni-th width="65" align="center">1</uni-th>
							<uni-th width="65" align="center">2</uni-th>
							<uni-th width="65" align="center">3</uni-th>
							<uni-th width="65" align="center">4</uni-th>
							<uni-th width="65" align="center">5</uni-th>
							<uni-th width="65" align="center">6</uni-th>
							<uni-th width="65" align="center">7</uni-th>
							<uni-th width="65" align="center">8</uni-th>
							<uni-th width="65" align="center">9</uni-th>
							<uni-th width="65" align="center">10</uni-th>
							<uni-th width="65" align="center">11</uni-th>
							<uni-th width="65" align="center">12</uni-th>
							<uni-th width="65" align="center">13</uni-th>
							<uni-th width="65" align="center">14</uni-th>
							<uni-th width="65" align="center">15</uni-th>
							<uni-th width="65" align="center">16</uni-th>
							<uni-th width="65" align="center">17</uni-th>
							<uni-th width="65" align="center">18</uni-th>
							<uni-th width="65" align="center">总差</uni-th>
							<uni-th width="65" align="center">总杆</uni-th>
						</uni-tr>
						<uni-tr>
							<uni-th width="65" align="center">{{parobj.strOne}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strTwo}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strThree}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strFour}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strFive}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strSix}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strSeven}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strEight}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strNine}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strTen}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strEleven}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strTwelve}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strThirteen}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strFourteen}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strFifteen}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strSixteen}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strSeventeen}}</uni-th>
							<uni-th width="65" align="center">{{parobj.strEighteen}}</uni-th>
							<uni-th width="65" align="center">-</uni-th>
							<uni-th width="65" align="center">{{pole==null?"-":pole}}</uni-th>
						</uni-tr>

						<uni-tr v-for="(item, index) in teamlistarr" :key="index">
							<uni-td @click.native="tableitem('strOne',item.strOneContribute,1,item.strOne)">
								<span
									:class="item.strOne ==null?'': 'style' + item.strOne">{{ item.strOne ==null?'':(item.strOne==1?'+1':item.strOne)}}</span>
							</uni-td>
							<uni-td @click.native="tableitem('strTwo',item.strTwoContribute,2,item.strTwo)">
								<span
									:class="item.strTwo ==null?'': 'style' + item.strTwo">{{ item.strTwo ==null?'':(item.strTwo==1?'+1':item.strTwo)}}</span>
							</uni-td>
							<uni-td @click.native="tableitem('strThree', item.strThreeContribute,3,item.strThree)">
								<span
									:class="item.strThree ==null?'': 'style' + item.strThree">{{ item.strThree ==null?'':(item.strThree==1?'+1':item.strThree)}}</span></uni-td>
							<uni-td @click.native="tableitem('strFour',item.strFourContribute,4,item.strFour)">
								<span
									:class="item.strFour ==null?'': 'style' + item.strFour">{{ item.strFour ==null?'':(item.strFour==1?'+1':item.strFour)}}</span></uni-td>
							<uni-td @click.native="tableitem('strFive',item.strFiveContribute,5,item.strFive)">
								<span
									:class="item.strFive ==null?'': 'style' + item.strFive">{{ item.strFive ==null?'':(item.strFive==1?'+1':item.strFive)}}</span></uni-td>
							<uni-td @click.native="tableitem('strSix', item.strSixContribute,6,item.strSix)">
								<span
									:class="item.strSix ==null?'': 'style' + item.strSix">{{ item.strSix ==null?'':(item.strSix==1?'+1':item.strSix)}}</span></uni-td>
							<uni-td @click.native="tableitem('strSeven',item.strSevenContribute,7 ,item.strSeven)">
								<span
									:class="item.strSeven ==null?'': 'style' + item.strSeven">{{ item.strSeven ==null?'':(item.strSeven==1?'+1':item.strSeven)}}</span>
							</uni-td>
							<uni-td @click.native="tableitem('strEight', item.strEightContribute,8,item.strEight)">
								<span
									:class="item.strEight ==null?'': 'style' + item.strEight">{{ item.strEight ==null?'':(item.strEight==1?'+1':item.strEight)}}</span>
							</uni-td>
							<uni-td @click.native="tableitem('strNine', item.strNineContribute,9,item.strNine)">
								<span
									:class="item.strNine ==null?'': 'style' + item.strNine">{{ item.strNine ==null?'':(item.strNine==1?'+1':item.strNine)}}</span>
							</uni-td>
							<uni-td @click.native="tableitem('strTen',item.strTenContribute,10,item.strTen)">
								<span
									:class="item.strTen ==null?'': 'style' + item.strTen">{{ item.strTen ==null?'':(item.strTen==1?'+1':item.strTen)}}</span>
							</uni-td>
							<uni-td @click.native="tableitem('strEleven',item.strElevenContribute,11,item.strEleven)">
								<span
									:class="item.strEleven ==null?'': 'style' + item.strEleven">{{ item.strEleven ==null?'':(item.strEleven==1?'+1':item.strEleven)}}</span>
							</uni-td>
							<uni-td @click.native="tableitem('strTwelve',item.strTwelveContribute,12,item.strTwelve)">
								<span
									:class="item.strTwelve ==null?'': 'style' + item.strTwelve">{{ item.strTwelve ==null?'':(item.strTwelve==1?'+1':item.strTwelve)}}</span>
							</uni-td>
							<uni-td
								@click.native="tableitem('strThirteen', item.strThirteenContribute,13,item.strThirteen)">
								<span
									:class="item.strThirteen ==null?'': 'style' + item.strThirteen">{{ item.strThirteen ==null?'':(item.strThirteen==1?'+1':item.strThirteen)}}</span></uni-td>
							<uni-td
								@click.native="tableitem('strFourteen',item.strFourteenContribute,14,item.strFourteen)">
								<span
									:class="item.strFourteen ==null?'': 'style' + item.strFourteen">{{ item.strFourteen ==null?'':(item.strFourteen==1?'+1':item.strFourteen)}}</span>
							</uni-td>
							<uni-td
								@click.native="tableitem('strFifteen',item.strFifteenContribute,15,item.strFifteen)">
								<span
									:class="item.strFifteen ==null?'': 'style' + item.strFifteen">{{ item.strFifteen ==null?'':(item.strFifteen==1?'+1':item.strFifteen)}}</span>
							</uni-td>
							<uni-td
								@click.native="tableitem('strSixteen',item.strSixteenContribute,16,item.strSixteen)">
								<span
									:class="item.strSixteen ==null?'': 'style' + item.strSixteen">{{ item.strSixteen ==null?'':(item.strSixteen==1?'+1':item.strSixteen)}}</span>
							</uni-td>
							<uni-td
								@click.native="tableitem('strSeventeen',item.strSeventeenContribute,17,item.strSeventeen)">
								<span
									:class="item.strSeventeen ==null?'': 'style' + item.strSeventeen">{{ item.strSeventeen ==null?'':(item.strSeventeen==1?'+1':item.strSeventeen)}}</span>
							</uni-td>
							<uni-td
								@click.native="tableitem('strEighteen',item.strEighteenContribute,18,item.strEighteen)">
								<span
									:class="item.strEighteen ==null?'': 'style' + item.strEighteen">{{ item.strEighteen ==null?'':(item.strEighteen==1?'+1':item.strEighteen)}}</span>
							</uni-td>
							<uni-td>{{ item.total ==null?'':item.total}}</uni-td>
							<uni-td>{{ item.differtotal ==null?'':item.differtotal}}</uni-td>
						</uni-tr>
					</uni-table>
				</view>
			</view>
		</view>
		<view class="contribute">
			<view class="title">
				贡献排行
			</view>
			<view class="table_item">
				<uni-table ref="table" :loading="loading" emptyText="暂无更多数据">
					<uni-tr>
						<uni-th width="30" align="center">NO</uni-th>
						<uni-th width="100" align="center">队员</uni-th>
						<uni-th align="center" width="50">
							<view>开球</view>
						</uni-th>
						<uni-th align="center" width="50">
							<view>ON</view>
							<view>果岭</view>
						</uni-th>
						<uni-th align="center" width="50">
							<view>推球</view>
							<view>入洞</view>
						</uni-th>
						<uni-th align="center" width="50">
							<view>综合</view>
							<view>成绩</view>
						</uni-th>
					</uni-tr>
					<uni-tr v-for="(item, index) in ranklist" :key="index">
						<uni-td>{{ index+1 }}</uni-td>
						<uni-td>
							<view class=""
								style="display: flex; align-items: center; justify-content: center; height: 100%;">
								<view class="">
									{{ item.nickName.length > 3 ? item.nickName.slice(0, 3) + '..' : item.nickName}}
								</view>
							</view>
						</uni-td>
						<uni-td>
							<view>{{ item.dvalue }}</view>
						</uni-td>
						<uni-td>
							<view>{{ item.ovalue }}</view>
						</uni-td>
						<uni-td>
							<view>{{ item.pvalue }}</view>
						</uni-td>
						<uni-td>
							<view>{{ item.totalContribute }}</view>
						</uni-td>
					</uni-tr>
				</uni-table>
			</view>
		</view>
		<u-popup :show="showpkpage" :closeable='true' :round="10" mode="center" @close='popupclose'>

			<view class="table_item_popup" v-if="content[0].active">
				<view class="popup_img">

				</view>
				<view class="tableauto">
					<uni-table ref="table" :loading="loading" emptyText="暂无更多数据">
						<uni-tr>
							<uni-th align="center" width="56">
								<view>NO</view>
							</uni-th>
							<uni-th align="center" width="150">
								<view>战队名称</view>
							</uni-th>
							<uni-th align="center" width="56">
								<view>成绩</view>
							</uni-th>
						</uni-tr>
						<uni-tr v-for="(item, index) in datalist" :key="index" @click.native="teamdetailfn(item,1)">
							<uni-td>
								<view>{{ index+1 }}</view>
							</uni-td>
							<uni-td>
								<view class="">
									{{item.teamName.length > 6 ? item.teamName.slice(0, 6) + '...' : item.teamName  }}
								</view>
							</uni-td>
							<uni-td>
								<view>{{ item.differtotal ==null?'':item.differtotal }}</view>
							</uni-td>
						</uni-tr>
					</uni-table>
				</view>

			</view>
			<view class="table_item_popup" v-else-if="content[1].active">
				<view class="popup_img">

				</view>
				<view class="tableauto">
					<uni-table ref="table" :loading="loading" emptyText="暂无更多数据">
						<uni-tr>
							<uni-th align="center" width="25">
								<view>NO</view>
							</uni-th>
							<uni-th align="center" width="85">
								<view>队员</view>
							</uni-th>
							<uni-th align="center" width="50">
								<view>开球</view>
							</uni-th>
							<uni-th align="center" width="50">
								<view>ON</view>
								<view>果岭</view>
							</uni-th>
							<uni-th align="center" width="50">
								<view>推球</view>
								<view>入洞</view>
							</uni-th>
							<uni-th align="center" width="50">
								<view>综合</view>
								<view>成绩</view>
							</uni-th>
						</uni-tr>
						<uni-tr v-for="(item, index) in ranklistall" :key="index" @click.native="teamdetailfn(item,2)">
							<uni-td>
								<view>{{ index+1 }}</view>
							</uni-td>
							<uni-td>
								<view class="">
									{{ item.nickName.length > 3 ? item.nickName.slice(0, 3) + '..' : item.nickName}}
								</view>
							</uni-td>
							<uni-td>
								<view>{{ item.dvalue }}</view>
							</uni-td>
							<uni-td>
								<view>{{ item.ovalue }}</view>
							</uni-td>
							<uni-td>
								<view>{{ item.pvalue }}</view>
							</uni-td>
							<uni-td>
								<view>{{ item.totalContribute }}</view>
							</uni-td>
						</uni-tr>
					</uni-table>
				</view>
			</view>
		</u-popup>
		<!-- 战队详情弹窗||个人详情弹窗 -->
		<u-popup :show="detailshow" :closeable='true' :round="10" mode="center" @close='detailshow=false'>
			<view class="item_team_detail">
				<view class="popup_img">

				</view>
				<view class="team_detail" v-if="detailtype==1">
					<view class="team_title">
						战队详情
					</view>
					<view class="ranking_table" style="overflow: auto;">
						<view class="table_left">
							<uni-table ref="table" :loading="loading" border emptyText="暂无更多数据">
								<uni-tr>
									<uni-th align="center">HOLE</uni-th>
								</uni-tr>
								<uni-tr>
									<uni-th align="center">PAR</uni-th>
								</uni-tr>
								<uni-tr v-for="(item, index) in teamdetailarr" :key="index">
									<uni-td>{{ item.teamName.length > 6 ? item.teamName.slice(0, 6) + '...' : item.teamName }}</uni-td>
								</uni-tr>
							</uni-table>
						</view>
						<view class="table_right">
							<uni-table ref="table" :loading="loading" border emptyText="暂无更多数据">
								<uni-tr>
									<uni-th width="65" align="center">1</uni-th>
									<uni-th width="65" align="center">2</uni-th>
									<uni-th width="65" align="center">3</uni-th>
									<uni-th width="65" align="center">4</uni-th>
									<uni-th width="65" align="center">5</uni-th>
									<uni-th width="65" align="center">6</uni-th>
									<uni-th width="65" align="center">7</uni-th>
									<uni-th width="65" align="center">8</uni-th>
									<uni-th width="65" align="center">9</uni-th>
									<uni-th width="65" align="center">10</uni-th>
									<uni-th width="65" align="center">11</uni-th>
									<uni-th width="65" align="center">12</uni-th>
									<uni-th width="65" align="center">13</uni-th>
									<uni-th width="65" align="center">14</uni-th>
									<uni-th width="65" align="center">15</uni-th>
									<uni-th width="65" align="center">16</uni-th>
									<uni-th width="65" align="center">17</uni-th>
									<uni-th width="65" align="center">18</uni-th>
									<uni-th width="65" align="center">总差</uni-th>
									<uni-th width="65" align="center">总杆</uni-th>
								</uni-tr>
								<uni-tr>
									<uni-th width="65" align="center">{{parobj.strOne}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strTwo}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strThree}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strFour}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strFive}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strSix}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strSeven}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strEight}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strNine}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strTen}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strEleven}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strTwelve}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strThirteen}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strFourteen}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strFifteen}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strSixteen}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strSeventeen}}</uni-th>
									<uni-th width="65" align="center">{{parobj.strEighteen}}</uni-th>
									<uni-th width="65" align="center">-</uni-th>
									<uni-th width="65" align="center">{{pole==null?"-":pole}}</uni-th>
								</uni-tr>
								<uni-tr v-for="(item, index) in teamdetailarr" :key="index">
									<uni-td>{{ item.strOne ==null?'':item.strOne}}</uni-td>
									<uni-td>{{ item.strTwo ==null?'':item.strTwo}}</uni-td>
									<uni-td>{{ item.strThree ==null?'':item.strThree}}</uni-td>
									<uni-td>{{ item.strFour ==null?'':item.strFour}}</uni-td>
									<uni-td>{{ item.strFive ==null?'':item.strFive}}</uni-td>
									<uni-td>{{ item.strSix ==null?'':item.strSix}}</uni-td>
									<uni-td>{{ item.strSeven ==null?'':item.strSeven}}</uni-td>
									<uni-td>{{ item.strEight ==null?'':item.strEight}}</uni-td>
									<uni-td>{{ item.strNine ==null?'':item.strNine}}</uni-td>
									<uni-td>{{ item.strTen==null?'':item.strTen }}</uni-td>
									<uni-td>{{ item.strEleven==null?'':item.strEleven }}</uni-td>
									<uni-td>{{ item.strTwelve ==null?'':item.strTwelve}}</uni-td>
									<uni-td>{{ item.strThirteen==null?'':item.strThirteen }}</uni-td>
									<uni-td>{{ item.strFourteen==null?'':item.strFourteen }}</uni-td>
									<uni-td>{{ item.strFifteen==null?'':item.strFifteen }}</uni-td>
									<uni-td>{{ item.strSixteen ==null?'':item.strSixteen}}</uni-td>
									<uni-td>{{ item.strSeventeen ==null?'':item.strSeventeen}}</uni-td>
									<uni-td>{{ item.strEighteen ==null?'':item.strEighteen}}</uni-td>
									<uni-td>{{ item.total ==null?'':item.total}}</uni-td>
									<uni-td>{{ item.differtotal ==null?'':item.differtotal}}</uni-td>
								</uni-tr>
							</uni-table>
						</view>
					</view>



				</view>
				<view class="person_detail" v-else-if="detailtype==2">
					<view class="detail_avatar">
						<u-avatar :src="userinfo.avatarUrl" size="70"></u-avatar>
					</view>
					<view class="detail_name">
						{{userinfo.nickName}}
					</view>
					<view class="detail_name_team">
						{{userinfo.teamName}}
					</view>

				</view>
			</view>
		</u-popup>
		<u-popup :show="show" :closeable='true' :round="10" mode="center" @close='close'>
			<view class="item_team_detail slot_setitem">
				<view class="popup_img">

				</view>
				<view class="settitle">
					贡献值设置
				</view>
				<view class="score">
					第{{numtype}}洞成绩 : {{scorenum}}
				</view>
				<view class="set_item" v-for="(item,index) in contribution" :key="index">
					<view class="name_item">
						{{item.name=='开球'?`开${'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'}球`:item.name}}
					</view>
					<view class="select_item">
						<uni-data-select v-model="item.value" placeholder='请选择成员' :localdata="range"></uni-data-select>
					</view>
				</view>
			</view>
		</u-popup>
		<uni-fab horizontal='right' :content="content" @trigger='trigger' :pattern='pattern'></uni-fab>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				capsule: {}, //记录胶囊位置
				numtype: '', //贡献值弹窗第几洞
				id: '', //赛事id
				form: {},
				// formobj:{}
				parobj: {},
				scorenum: 0, //贡献值弹窗成绩
				str: '', //记录用户点击的洞数
				teamlistarr: [], //个人战队
				datalist: [], //战队pk总排行列表
				userinfo: {}, //个人详情
				detailtype: '', //弹窗展示队伍||个人信息类型
				teamdetailarr: [], //战队详情 
				ranklist: [], //当前队伍的贡献排行
				ranklistall: [], //所有队伍前20名的贡献排行
				weather: {
					wea: "",
					temNight: "",
					temDay: "",
					winSpeed: "",
					win: "",
				}, //天气
				detailshow: false, //战队||个人详情
				show: false, //编辑贡献值弹窗
				showpkpage: false, //pk列表弹窗
				range: [], //贡献值设置队员下拉
				content: [{ //悬浮按钮配置内容
						iconPath: 'https://web.ptgolf.net/image/webchat/30.png',
						selectedIconPath: 'https://web.ptgolf.net/image/webchat/29.png',
						text: '队伍',
						active: false
					},
					{
						iconPath: 'https://web.ptgolf.net/image/webchat/27.png',
						selectedIconPath: 'https://web.ptgolf.net/image/webchat/28.png',
						text: '贡献值',
						active: false
					},

				],
				pattern: { //悬浮按钮配置样式
					color: '#7A7E83',
					backgroundColor: '#fff',
					selectedColor: '#de3600',
					buttonColor: '#de3600',
					iconColor: '#1e1e1e',
					icon: 'staff-filled'
				},
				contribution: [{
					name: '开球',
					value: 0
				}, {
					name: 'O N 果岭',
					value: 0
				}, {
					name: '推球入洞',
					value: 0
				}, ]
			}
		},
		created() {

		},
		computed: {

			// 计算属性 fullName 会基于 firstName 和 lastName 进行缓存
			pole: function() {
				return this.parobj.strOne + this.parobj.strTwo + this.parobj.strThree + this.parobj.strFour + this
					.parobj.strFive + this.parobj.strSix + this.parobj.strSeven + this.parobj.strEight + this
					.parobj
					.strNine + this.parobj.strTen + this.parobj.strEleven + this.parobj.strTwelve + this.parobj
					.strThirteen + this.parobj.strFourteen + this.parobj.strFifteen + this.parobj.strSixteen + this
					.parobj.strSeventeen + this.parobj.strEighteen
			},
			difference: function() {
				return this.datalist.reduce((sum, item) => sum + item.differtotal, 0);
			}
		},
		onLoad(options) {
			// 从路由参数中获取传递的值			
			this.id = decodeURIComponent(options.id);
			this.formdetail()
			this.headerdetail()
		},
		mounted() {

			this.capsule = uni.getMenuButtonBoundingClientRect();

		},
		methods: {
			goonefn() {
				uni.navigateBack({
					delta: 1
				});
			},
			gohomefn() {
				uni.reLaunch({
					url: '/pages/homepage/homepage'
				});
			},
			teamdetailfn(e, type) {

				this.detailtype = type
				if (type == 1) {
					this.teamdetailarr = [e]
				} else if (type == 2) {
					this.userinfo = e
				}
				this.detailshow = true
			},
			// 弹窗关闭点击事件
			popupclose() {
				this.showpkpage = false
				this.content.forEach((item, index) => {
					item.active = false;
				});
			},
			// 悬浮按钮项点击事件
			trigger(e) {
				const that = this
				if (e.index == 0) { //index==0时请求队伍pk列表
					this.$request(`/race/teamRank/${this.id}`, 'get')
						.then(
							res => {
								that.datalist = res.data.data
								// that.parobj = res.data.data
								that.datalist.forEach(item => {
									let total = 0;

									// 你可以手动列出这些属性
									let lhProperties = [
										"strOne", "strTwo", 'strThree', 'strFour', 'strFive',
										'strSix',
										'strSeven',
										'strEight', 'strNine', 'strTen',
										'strEleven', 'strTwelve', 'strThirteen', 'strFourteen',
										'strFifteen',
										'strSixteen', 'strSeventeen', 'strEighteen'
									];

									// 计算 total
									lhProperties.forEach(prop => {
										total += item[prop]; // 将每个属性的值累加到 total
									});

									// 将 total 添加到当前对象中
									item.total = total;
									item.differtotal = total + that.pole
								});
							})

				} else { //否则当index=1时请求贡献值排行列表 
					this.$request(`/race/contributeRank/${that.id}`, 'get')
						.then(
							res => {

								that.ranklistall = res.data.data
							})
				}
				this.content.forEach((item, index) => {
					item.active = (index == e.index);
				});
				this.showpkpage = true
			},
			// 点击每一洞事件
			tableitem(str, e, num, score) {
				this.scorenum = score ? score : 0
				this.numtype = num
				this.contribution.forEach(item => {
					item.value = 0; // 将每个对象的 value 设置为空数组
				});
				this.str = str
				const that = this
				this.$request(`/race/getMemberSelectByTeamId/${this.teamlistarr[0].teamId}`, 'get')
					.then(
						res => {

							that.range = res.data.data.map(item => ({
								value: item.memberId,
								text: item.nickName
							}))

						})
				// 将字符串按照逗号分隔
				const pairs = e == null ? [] : e.split(',');

				// 遍历这些值，每一对成对出现的值是 index 和 num
				for (let i = 0; i < pairs.length; i += 2) {
					const index = parseInt(pairs[i], 10); // 获取索引
					const num = parseInt(pairs[i + 1], 10); // 获取 num

					// 确保 index 在数组范围内并且原始数组项的 value 数组不为空
					if (index >= 0 && index < this.contribution.length) {
						this.contribution[index].value = num; // 反向赋值给对应项的 num 属性
						// this.scorenum = this.scorenum + Number(num)
						// console.log(this.scorenum);
					}
				}
				this.show = true
			},
			submit() {
				const that = this
				const data = {
					raceId: this.id,
					teamId: this.teamlistarr[0].teamId,
					[this.str]: this.contribution.map((item, index) => `${index},${item.value?item.value:0}`).join(
						',')
				}
				this.$request(`/race/editContribute`, 'post', data)
					.then(
						res => {
							// if (!res.data.data.flag) {
							// 	that.$refs.uToast.show({
							// 		type: 'error',
							// 		message: "设置贡献值失败",
							// 		iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/top.png',
							// 	})
							// } else {
							// 	that.$refs.uToast.show({
							// 		type: 'success',
							// 		message: "设置贡献值成功",
							// 		iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
							// 	})
							// }
							// that.close()
							that.formdetail()
						})
			},
			close() {
				this.submit()
				this.show = false
			},
			headerdetail() {
				const that = this
				// 顶部赛事信息
				this.$request(`/race/runDetail/${this.id}`, 'get')
					.then(
						res => {
							that.form = res.data.data
						})
				// 天气信息
				this.$request(`/race/getWeather/${this.id}`, 'get')
					.then(
						res => {
							that.weather = res.data.data
						})
			},
			formdetail() {
				const that = this
				// par标准杆数据
				this.$request(`/race/barSetting/${this.id}`, 'get')
					.then(
						res => {
							that.parobj = res.data.data

							//队伍信息
							this.$request(`/race/teamScore/${this.id}`, 'get')
								.then(
									res => {
										if (res.data.data.teamName == null) {
											that.teamlistarr = []
											return
										}
										that.teamlistarr = [res.data.data]
										// that.parobj = res.data.data
										that.teamlistarr.forEach(item => {
											let total = 0;

											// 你可以手动列出这些属性
											let lhProperties = [
												"strOne", "strTwo", 'strThree', 'strFour', 'strFive',
												'strSix',
												'strSeven',
												'strEight', 'strNine', 'strTen',
												'strEleven', 'strTwelve', 'strThirteen', 'strFourteen',
												'strFifteen',
												'strSixteen', 'strSeventeen', 'strEighteen'
											];

											// 计算 total
											lhProperties.forEach(prop => {
												total += item[prop]; // 将每个属性的值累加到 total
											});

											// 将 total 添加到当前对象中
											item.total = total;
											item.differtotal = total + that.pole
										});
										// 贡献排行//队伍
										that.$request(`/race/contributeRank/${that.id}/${that.teamlistarr[0].teamId}`,
												'get')
											.then(
												res => {
													that.ranklist = res.data.data
												})
									})


						})



			},

		}
	}
</script>

<style scoped lang="scss">
	.item-block {

		height: calc(100vh);
		overflow: auto;
		background-color: #000;

		.headerimg {
			height: calc(70vh - 323px);
			background-size: 100% 100%;
			background-image: url('https://web.ptgolf.net/image/webchat/34.png');
		}

		.capsule {
			left: 10px;
			background-color: rgba(0, 0, 0, 0.5);
			border: 1px solid #fff;
			border-radius: 30px;
			position: fixed;
			display: flex;

			.icon-fanhui {

				border-right: 1px solid #fff;
			}

			.icon-zhuye,
			.icon-fanhui {
				margin: 5px 0;
				width: calc(50% - 1rpx);
				color: #fff;
				height: calc(100% - 10px);
				font-size: 20px;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}

		.broadcast {
			display: flex;
			justify-content: space-between;
			height: 40px;
			margin-bottom: 10px;

			.weather {
				width: 25%;
				text-align: center;
				display: flex;
				flex-direction: column;
				justify-content: space-around;

				.weather_text {
					font-size: 22rpx;
					color: #fff;
				}

				.weather_item {
					font-size: 28rpx;
					color: #de3600;
				}


			}

			.weather_cen {
				border-right: 1px solid #de3600;
				border-left: 1px solid #de3600;
				width: 40%;
				text-align: center;
				display: flex;
				flex-direction: column;
				justify-content: space-around;


				.weather_place {
					font-size: 18rpx;
					color: #fff;
					display: flex;
					justify-content: center;

					.icon-dizhi {
						font-size: 16rpx;
						padding: 2px;
						border-radius: 50%;
						background-color: #de3600;
						margin-right: 2px;
					}
				}

				.cen_name {
					font-size: 26rpx;
					color: #fff;
				}

			}
		}

		.ranking {
			height: 162px;

			.title {
				font-size: 28rpx;
				// font-weight: 600;
				padding-bottom: 5px;
				padding-left: 20px;
				color: #fff;
			}
		}

		::v-deep .u-popup__content {
			background-image: url('https://web.ptgolf.net/image/webchat/31.png');
			background-size: 100% 100%;
			border-radius: 31px !important;

		}

		.ranking_table {
			display: flex;
			overflow-y: auto;
			max-height: calc(100% - 27px);
			overflow-x: hidden;
			background-color: #fff;

			.style-1 {
				background-color: #de3600;
				padding: 1px 4px;
				border-radius: 50%;
				color: #fff;
			}

			.style-2,
			.style-3,
			.style-4 {
				background-color: #f4ce0f;
				border-radius: 50%;
				padding: 1px 4px;
				color: #fff;
			}

			.style1 {
				padding: 0px 2px;
				border: 1px solid #000;
			}

			::v-deep .uni-table-th {
				font-size: 13px;
				color: #de3600;
				font-weight: 400;
			}


			.table_left {
				width: 35%;
				box-shadow: 5px 0px 5px #f4f4f4;
				/* 右侧阴影，垂直偏移量为0 */
				z-index: 3;

				::v-deep .uni-table-td {
					line-height: 32px !important;
					white-space: nowrap;
					/* 防止文字换行 */
					overflow: hidden;
					/* 隐藏超出部分 */
					text-overflow: ellipsis;
					/* 超出部分显示省略号 */
					text-align: center !important;
				}

				::v-deep .uni-table {
					min-width: 0 !important;
				}
			}

			.table_right {
				width: 65%;

				::v-deep .uni-table-td {
					text-align: center !important;
					line-height: 32px !important;
				}
			}

			::v-deep .uni-table-td {
				height: 35px !important;

			}

		}


		.contribute {
			margin-top: 10px;
			border-radius: 20px 20px 0 0;
			background-color: #fff;
			padding: 15px;
			height: calc(30% + 70px);


			.title {
				margin-bottom: 10px;
				font-size: 28rpx;
				// font-weight: 600;
			}

		}

		.table_item,
		.table_item_popup {
			height: calc(100% - 32px);
			overflow-y: auto;

			::v-deep .uni-table-th {
				border: 0 !important;
				font-size: 13px;
				color: #de3600;
				font-weight: 400;
				padding: 12px 5px !important;
			}

			::v-deep .uni-table .uni-table-tr {
				height: 40px;
			}

			::v-deep .uni-table .uni-table-tr:nth-child(2n) {
				background-color: #f4f4f4 !important;

				:first-child {
					border-radius: 8px 0 0 8px !important;
				}

				:last-child {
					border-radius: 0 8px 8px 0 !important;
				}
			}

			::v-deep .uni-table-td {
				border: 0 !important;
				line-height: 30px;
				text-align: center !important;
			}
		}

		::v-deep .uicon-close {
			color: #de3600 !important;
		}

		.table_item_popup {

			width: 90vw;
			padding: 60px 10px 20px;
			height: 380px;
			position: relative;


			.popup_img {
				position: absolute;
				top: 20px;
				left: 20px;
				background-image: url('https://web.ptgolf.net/image/webchat/32.png');
				background-size: 100% 100%;
				height: 35px;
				width: 60px;
			}

			.tableauto {

				height: 260px;
				overflow-y: auto;
			}

			::v-deep .uni-table {
				background-color: transparent !important;
			}

			::v-deep .uni-table .uni-table-tr:nth-child(2n) {
				background-color: #ffa78f !important;


			}

			::v-deep .uni-table .head th {
				position: sticky;
				top: 0;
				z-index: 2;
				background-color: #fff;
			}

			::v-deep .uni-table-scroll {
				overflow: visible;
			}


		}

		.item_team_detail {
			width: 90vw;
			padding: 60px 10px 20px;
			height: 380px;
			position: relative;

			.team_title {
				color: #de3600;
				font-size: 20px;
				font-weight: 600;
				text-align: center;
				margin-bottom: 30px;
			}

			::v-deep .uni-table {
				background-color: transparent !important;
			}

			.table_right {
				width: 64%;
			}

			.popup_img {
				position: absolute;
				top: 20px;
				left: 20px;
				background-image: url('https://web.ptgolf.net/image/webchat/32.png');
				background-size: 100% 100%;
				height: 35px;
				width: 60px;
			}

			.person_detail {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				padding: 30px;

				// .detail_name,
				.detail_name_team {
					font-size: 35px;
					color: #de3600;
					font-weight: 600;
				}

				.detail_name {
					margin: 10px 0 15px;
				}

			}
		}



		.slot_setitem {
			::v-deep .uniui-clear:before {
				font-size: 18px;
				content: "\e60c" !important;
				font-family: "iconfont";
				/* 设置字体图标的字体 */
				color: #de3600;
			}

			::v-deep .uni-select {
				background-color: #fff;
				border: 1px solid #de3600 !important;
			}

			.settitle {
				font-size: 12px;
				margin: 7px 0;
			}

			.score {
				// text-align: center;
				font-size: 20px;
				margin-bottom: 10px;
				// font-weight: 600;
				color: #de3600;
			}

			.set_item {
				display: flex;
				justify-content: space-around;
				margin-bottom: 10px;
				align-items: center;

				.name_item {
					font-size: 18px;
					// font-weight: 600;
					color: #de3600;
				}

				.select_item {
					width: 70%;
				}
			}
		}

		::v-deep .u-button {
			background-color: #de3600;
			border: 0 !important;
		}

		::v-deep .uniui-staff-filled:before {
			content: "\e681" !important;
			font-family: "iconfont";
			/* 设置字体图标的字体 */
			color: #1e1e1e;

		}

	}
</style>